<template>
  <div id="home">
     <!-- 3.使用 -->
     <movie-item v-for="(item,index) of movies" 
     :key="index" :movie="item"></movie-item>
  </div>
</template>
<script>
import {MovieModel} from "../../models/MovieModel";
const movieModel = new MovieModel();
/* 1.引入 */
import MovieItem from "./components/item";
export default {
  data(){
    return {
      movies:[]
    }
  },
  mounted(){
    movieModel.getTop250().then(res=>{
      var subjects = res.subjects;
      this.movies = subjects;
    })
  },
  /* 2.注册 */
  components:{
    MovieItem
  }
};
</script>
<style scoped>
#home{
  display: flex;
  flex-wrap: wrap;
  padding:100px;
  justify-content: space-between;
}
</style>



